<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!--<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />-->
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/Public/favicon.ico" >
<LINK rel="Shortcut Icon" href="/Public/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui/css/style.css" />
<link rel="stylesheet" href="/Public/css/page.css">

<link href="/Public/dxk/icheck.css" rel="stylesheet">
<script src="/Public/dxk/icheck.js?v=1.0.2"></script>
              
                <script>
                    $(document).ready(function(){
                        $('.user-sex input').each(function(){
                            var self = $(this),
                                    label = self.next(),
                                    label_text = label.text();

                            label.remove();
                            self.iCheck({
                                checkboxClass: 'icheckbox_sm-blue',
                                radioClass: 'radio_sm-blue',
                                insert: label_text
                            });
                        });
                    });
                </script>
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<title>查询统计</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 查询统计  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
	    <form action="<?php echo U('Static/index');?>"  method="post">
	        <ul class="secrch">
						<li> 贷款总行
						<select name="parent_bank" class="select-box inline select-zong">
							<option value="0">所有银行</option>
							<?php if(is_array($parents)): $i = 0; $__LIST__ = $parents;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$p): $mod = ($i % 2 );++$i;?><option value="<?php echo ($p["bank_id"]); ?>" <?php if($p['bank_id'] == $parent): ?>selected<?php endif; ?>><?php echo ($p["bank_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
						</select></li>
						 <li>  贷款支行
						<select name="child_bank" class="select-box inline select-zhi">
							<?php if(empty($child)): ?><option value="">所有支行</option><?php else: ?><option value="<?php echo ($child); ?>" class=""><?php echo (getBankName($child)); ?></option><?php endif; ?>
						</select></li>
                 <li> 送审时间
                    <input class="input-text kk" onClick="laydate()" style=" width:100px" name="send_start" value="<?php echo ($send_start); ?>">
            		-
            		<input class="input-text kk" onClick="laydate()" style=" width:100px" name="send_end" value="<?php echo ($send_end); ?>"></li>
                 <li>实际放款时间
                    <input class="input-text kk" onClick="laydate()" style=" width:100px" name="money_start" value="<?php echo ($money_start); ?>">
            		-
            		<input class="input-text kk" onClick="laydate()" style=" width:100px" name="money_end" value="<?php echo ($money_end); ?>"></li>
                 <li>营销人<input type="text" name="market"   class="input-text kk" style=" width:120px" value="<?php echo ($market); ?>"></li>
                 <li>签单人<input type="text" name="sign"  class="input-text kk" style=" width:120px" value="<?php echo ($sign); ?>"></li>
							 <?php if(($user["roleid"]) == "4"): ?><li>区域
									 <select name="place" class="select-box inline">
			 							<option value="">所有区域</option>
			 							<option value="1" <?php if($place == 1): ?>selected<?php endif; ?>>市区</option>
										<option value="2" <?php if($place == 2): ?>selected<?php endif; ?>>江宁</option>
										<option value="3" <?php if($place == 3): ?>selected<?php endif; ?>>江北</option>
			 						</select>
								 </li><?php endif; ?>
							 <?php if(($user["roleid"]) == "4"): ?><li>贷款类型
									 <select name="supervise" class="select-box inline">
										 		<option value="">所有类型</option>
											 <option value="1" <?php if($supervise == 1): ?>selected<?php endif; ?>>贷款监管</option>
											 <option value="2" <?php if($supervise == 2): ?>selected<?php endif; ?>>全款监管</option>
											 <option value="3" <?php if($supervise == 3): ?>selected<?php endif; ?>>不监管</option>
									 </select>
								 </li><?php endif; ?>
                 <li><button type="submit" class="btn btn-success radius" ><i class="Hui-iconfont">&#xe665;</i>搜索</button></li>
            </ul>
	    </form>
    </div>
<?php if(!empty($document)): ?><div class="dc">
    <div class="dc-left">共<span class="fonnt02"><?php echo ($docnum); ?>条</span> 商业贷款总金额<span class="fonnt02"><?php echo ($sumbusy); ?>万元</span> 公积金贷款总金额<span class="fonnt02"><?php echo ($sumaccount); ?>万元</span></div>
    <div class="dc-right"><a href="" id="daochu" ><button type="button" class="btn btn-success radius" >导出Excel</button></a></div>
    </div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
          <th width="20"></th>
					<th width="80">姓名</th>
					<th width="100">监管类型</th>
					<th width="80">贷款银行</th>
          <th width="80">贷款支行</th>
					<th width="80">商业贷款金额(万元)</th>
          <th width="80">贷款总金额(万元)</th>
          <th width="120">营销人</th>
          <th width="120">签单人</th>
          <th width="75">送审时间</th>
          <th width="100">实际放款时间</th>
				</tr>
			</thead>
			<tbody>
				<?php if(is_array($document)): $i = 0; $__LIST__ = $document;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$doc): $mod = ($i % 2 );++$i;?><tr class="text-c">
          <td><?php echo ($i); ?></td>
					<td><u style="cursor:pointer" class="text-primary" onClick="article_edit('查看','<?php echo U('Index/mortgagealert',array('doc_id'=>$doc['doc_id']));?>')" title="查看"><?php echo ($doc["buy_name"]); ?></u></td>
					<td><?php echo ($doc['supervise']=='1'?'贷款监管':($doc['supervise']=='2'?'全款监管':'不监管')); ?></td>
					<td><?php echo (getBankName($doc["bank_id"])); ?></td>
          <td><?php echo (getBankName($doc["part_bank_id"])); ?></td>
					<td><?php echo (getMoney($doc["doc_id"])); ?></td>
					<td><?php echo ($doc["amount"]); ?></td>
					<td><?php echo (getUsername($doc["market_id"])); ?></td>
          <td><?php echo (getUsername($doc["sign_id"])); ?></td>
          <td><?php if($doc['audit_time'] != ''): echo (turnTime($doc["audit_time"])); endif; ?></td>
          <td><?php if($doc['credit_real_time'] != ''): echo (turnTime($doc["credit_real_time"])); endif; ?></td>
				</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			</tbody>
		</table>
	</div>
	<div class="manu">
	    <?php echo ($page); ?>
	</div>
</div>
<?php else: ?>
搜索数据为空<?php endif; ?>

<script type="text/javascript" src="/Public/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="/Public/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/messages_zh.min.js"></script>
<script type="text/javascript" src="/Public/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/Public/static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/Public/lib/Validform/5.3.2/Validform.min.js"></script>
<script src="/Public/laydate/laydate.js"></script>

    <script>
    $('#daochu').click(function(){
      var parent_bank = $("select[name=parent_bank]").val();
      var child_bank = $("select[name=child_bank]").val();
      var send_start = $("input[name=send_start]").val();
      var send_end = $("input[name=send_end]").val();
      var money_start = $("input[name=money_start]").val();
      var money_end = $("input[name=money_end]").val();
      var market = $("input[name=market]").val();
      var sign = $("input[name=sign]").val();
			var place = $("select[name=place]").val();
			var sup = $("select[name=supervise]").val();
      var url = "<?php echo U('Excel/search');?>?parentbank="+parent_bank+"&&childbank="+child_bank+"&&sendstart="+send_start+"&&sendend="+send_end+"&&moneystart="+money_start+"&&moneyend="+money_end+"&&market="+market+"&&sign="+sign+"&&place="+place+"&&supervise="+sup
      $(this).attr("href" , url);
})
</script>
<script type="text/javascript">
$('.select-zong').change(function(){
    var len=$('.select-zong option').length;
    for(i = 0;i < len;i++){
        if($('.select-zong option').eq(i).is(':selected')){
            var id=$('.select-zong option').eq(i).val();
        }
    }
    $.ajax({
        type:'post',
        url:"<?php echo U('Static/zhi');?>",
        data:{id:id},
        dataType:'json',
        success:function(json){
            // alert(json[0][])
            // alert(JSON.stringify(json))
            console.log(json);
            // alert(json[0]['bank_id']);
            $('.select-zhi').empty();
            $('.select-zhi').append('<option value="">选择银行</option>')
            var len=json.length;
            for(i = 0;i <= len;i++){
                $('.select-zhi').append('<option value='+json[i]['bank_id']+'>'+json[i]['bank_name']+'</option>')
            }
        }
    })
})


$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8]}// 不参与排序的列
	]
});

/*建档-添加*/
function picture_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-删除*/
function article_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}

</script>
</body>
</html>